package kr.totalcall.view.popup
{
	import mx.events.CloseEvent;
	import mx.events.EffectEvent;
	import mx.managers.PopUpManager;
	
	import spark.components.TitleWindow;

	public class PopupController
	{
		
		/**
		 * popup 화면을 위쪽으로 올린다.
		 */
		public static function upWindow(popup:TitleWindow):void{
			if(popup.visible == true){
				PopUpManager.bringToFront(popup);
				return;
			}
			
			popup.visible = true;
			
			if( popup.bottom == 0 ){
				popup.bottom = -popup.height;
			}else{
				popup.bottom = 0;
			}
		}
		
		/**
		 * popup close handler
		 */
		public static function downWindow(event:CloseEvent):void {
			var popup:TitleWindow = event.target as TitleWindow;
			popup.bottom = -popup.height;
		}
		
		
		/**
		 * popup effect end handler
		 */
		public static function popupEffectEndHandler(event:EffectEvent):void {
			var popup:TitleWindow = event.target as TitleWindow;
			
			if( popup.bottom == -popup.height ){
				popup.visible = false;
			}
		}
		
		
		public function PopupController()
		{
		}
	}
}